home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / xview / xhist / help.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-17  |  5.7 KB  |  213 lines

  1.  
  2. #include <stdio.h>
  3. #include <sys/param.h>
  4. #include <sys/types.h>
  5.  
  6. #include <X11/X.h>
  7. #include <X11/Xlib.h>
  8.  
  9. #include <xview/xview.h>
  10. #include <xview/frame.h>
  11. #include <xview/panel.h>
  12. #include <xview/canvas.h>
  13. #include <xview/font.h>
  14. #include <xview/xv_xrect.h>
  15.  
  16. #define color_White  WhitePixel(dpy0, DefaultScreen(dpy0))
  17. #define color_Black  BlackPixel(dpy0, DefaultScreen(dpy0))
  18.  
  19. extern u_long color_Red;
  20. extern u_long color_Blue;
  21. extern u_long color_Green;
  22. extern u_long color_Orange;
  23.  
  24. #define TXTHT2 19
  25.  
  26. Frame     help_frame;
  27.  
  28. Xv_Font   def_font;
  29.  
  30. help_proc()
  31. {
  32.     Canvas    canvas;
  33.     Panel     panel;
  34.     XGCValues gcvalues;
  35.     void      help_repaint_proc();
  36.     void      help_quit();
  37.  
  38. /*
  39.  xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
  40. */
  41.  
  42.     help_frame = (Frame) xv_create(NULL, FRAME,
  43.                    FRAME_LABEL, " xhist help manual ",
  44.                    XV_WIDTH, 570,
  45.                    XV_HEIGHT, 720,
  46.                    NULL);
  47.  
  48.     canvas = (Canvas) xv_create(help_frame, CANVAS,
  49.                 XV_X, 0,
  50.                 XV_Y, 0,
  51.                 XV_WIDTH, WIN_EXTEND_TO_EDGE,
  52.                 XV_HEIGHT, 680,
  53.                 CANVAS_X_PAINT_WINDOW, TRUE,
  54.                 CANVAS_REPAINT_PROC, help_repaint_proc,
  55.                 NULL);
  56.  
  57. /* window_fit(help_frame); */
  58.  
  59.     panel = (Panel) xv_create(help_frame, PANEL,
  60.                   XV_X, 0,
  61.                   XV_Y, 680,
  62.                   XV_WIDTH, WIN_EXTEND_TO_EDGE,
  63.                   XV_HEIGHT, WIN_EXTEND_TO_EDGE,
  64.                   NULL);
  65.  
  66.     (void) xv_create(panel, PANEL_BUTTON,
  67.              XV_X, 200,
  68.              XV_Y, 12,
  69.              PANEL_LABEL_STRING, "Quit  help  manual",
  70.              PANEL_NOTIFY_PROC, help_quit,
  71.              NULL);
  72.  
  73.     def_font = (Xv_Font) xv_find(help_frame, FONT,
  74.                  FONT_STYLE, FONT_STYLE_BOLD, NULL);
  75.  
  76.     xv_main_loop(help_frame);
  77. }
  78.  
  79. void
  80. help_repaint_proc(canvas, pw, dpy0, xwin, xrects)
  81.     Canvas    canvas;
  82.     Xv_window pw;
  83.     Display  *dpy0;
  84.     Window    xwin;
  85.     Xv_xrectlist *xrects;
  86. {
  87.     int       i;
  88.     char     *t[50];
  89.     GC        gc2;
  90.     Font      fid;
  91.     int       ypos;
  92.  
  93.     for (i = 0; i < 50; i++)
  94.     t[i] = NULL;
  95.     t[0] = "xhist - display the histogram of an image";
  96.     t[1] = " ";
  97.  
  98.     t[2] = "SYNOPSIS -----------------------------------------------------------";
  99.  
  100.     t[3] = "    % xhist";
  101.     t[4] = "    % xhist image_file";
  102.     t[5] = "    % xhist < image_file";
  103.     t[6] = "    % ...... | xhist               ( pipe )";
  104.  
  105.     t[10] = "DESCRIPTION --------------------------------------------------------";
  106.     t[11] = "  Type of image file may be byte, short, int, or float.";
  107.     t[12] = "  All red numbers are pixel values.";
  108.     t[13] = "  All blue numbers are the counts of pixel values";
  109.     t[14] = "                                  (or counts of a range of pixel values).";
  110.     t[15] = "  Each vertical line refers to a pixel value ( or a range of pixel values )";
  111.     t[16] = "                                          and its counts.";
  112.  
  113.     t[17] = "  The red vertical line is used to check a certain pixel value.";
  114.     t[18] = "  Orange vertical lines represent the range of interesting pixel values.";
  115.     t[19] = "  Green horizontal lines represent the range of interesting counts.";
  116.  
  117.     t[25] = "CONTORL  BUTTONS --------------------------------------------------";
  118.     t[26] = "  Check pixel value :  check the pixel value specified by \"pixel value : __\" field";
  119.     t[28] = "  <--  :  move red vertical bar left by 1 unit";
  120.     t[29] = "  -->  :  move red vertical bar right by 1 unit";
  121.     t[30] = "  Select |  :   select vertical margin (orange vertical line) for next region";
  122.     t[31] = "  Eval :  Evaluate a region within vertical ( and horizontal ) margins";
  123.     t[32] = "  Restore :  restore histogram for this image";
  124.     t[33] = "  Set count margin : set the count margin specified by \"count margin : __\" field";
  125.  
  126.     t[34] = "  Load :  load image file";
  127.     t[35] = "  QUIT :  quit xhist";
  128.     t[36] = "  Help :  show this help manual";
  129.  
  130.     t[40] = "MOUSE  EVENTS  on the graph ------------------------------------------";
  131.     t[41] = "  LEFT BUTTON :  move red vertical bar to check pixel value and its counts";
  132.     t[42] = "  MIDDLE BUTTON :  select vertical margin (orange vertical line) for next region";
  133.     t[43] = "  RIGHT BUTTON :  select horizontal margin (green horizonal line) for next region";
  134.  
  135.     gc2 = DefaultGC(dpy0, DefaultScreen(dpy0));
  136.  
  137.     XSetForeground(dpy0, gc2, color_Black);
  138.     XSetBackground(dpy0, gc2, color_White);
  139.     fid = (Font) xv_get(def_font, XV_XID);
  140.     XSetFont(dpy0, gc2, fid);
  141.  
  142.     XDrawString(dpy0, xwin, gc2, 20, 24, t[0], strlen(t[0]));
  143.     ypos = 52;
  144.     for (i = 2; i < 50; i++) {
  145.     switch (i) {
  146.     case 37:
  147.     case 7:
  148.         ypos = ypos + 14;
  149.         break;        /* blank line      */
  150.     case 12:
  151.         XSetForeground(dpy0, gc2, color_Red);
  152.         break;
  153.     case 13:
  154.         XSetForeground(dpy0, gc2, color_Blue);
  155.         break;
  156.     case 15:
  157.         XSetForeground(dpy0, gc2, color_Black);
  158.         break;
  159.     case 17:
  160.         XSetForeground(dpy0, gc2, color_Red);
  161.         break;
  162.     case 18:
  163.         XSetForeground(dpy0, gc2, color_Orange);
  164.         break;
  165.     case 19:
  166.         XSetForeground(dpy0, gc2, color_Green);
  167.         break;
  168.     case 20:
  169.         XSetForeground(dpy0, gc2, color_Black);
  170.         ypos = ypos + 14;
  171.         break;
  172.  
  173.     case 28:
  174.         XSetForeground(dpy0, gc2, color_Red);
  175.         break;
  176.     case 30:
  177.         XSetForeground(dpy0, gc2, color_Orange);
  178.         break;
  179.     case 31:
  180.         XSetForeground(dpy0, gc2, color_Black);
  181.         break;
  182.     case 33:
  183.         XSetForeground(dpy0, gc2, color_Green);
  184.         break;
  185.     case 34:
  186.         XSetForeground(dpy0, gc2, color_Black);
  187.         ypos = ypos + 14;
  188.         break;
  189.  
  190.     case 41:
  191.         XSetForeground(dpy0, gc2, color_Red);
  192.         break;
  193.     case 42:
  194.         XSetForeground(dpy0, gc2, color_Orange);
  195.         break;
  196.     case 43:
  197.         XSetForeground(dpy0, gc2, color_Green);
  198.         break;
  199.     }
  200.     if (t[i] == NULL)
  201.         continue;
  202.     XDrawString(dpy0, xwin, gc2, 10, ypos, t[i], strlen(t[i]));
  203.     ypos = ypos + TXTHT2;
  204.     }
  205.  
  206. }
  207.  
  208. void
  209. help_quit()
  210. {
  211.     xv_destroy_safe(help_frame);
  212. }
  213.